import type { RouteRecordRaw } from "vue-router";
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      hidden: true,
    },
  },

  {
    path: "/404",
    name: "404",
    component: () => import("@/views/error/404.vue"),
    meta: {
      hidden: true,
    },
  },

  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "Home",
        component: () => import("@/views/home/index.vue"),
        meta: {
          title: "首页",
          icon: "ele-HomeFilled",
        },
      },
    ],
  },
];

/**
 * 定义动态路由
 */
export const allAsyncRoutes: Array<RouteRecordRaw> = [
  {
    path: "/acl",
    name: "Acl",
    component: () => import("@/layout/index.vue"),
    redirect: "/acl/user/list",
    meta: {
      title: "权限管理",
      icon: "ele-Setting",
    },
    children: [
      {
        name: "User",
        path: "/acl/user/list",
        component: () => import("@/views/acl/user/index.vue"),
        meta: {
          title: "用户管理",
        },
      },
      {
        name: "Role",
        path: "/acl/role/list",
        component: () => import("@/views/acl/role/index.vue"),
        meta: {
          title: "角色管理",
        },
      },
      {
        name: "RoleAuth",
        path: "/acl/role/auth",
        component: () => import("@/views/acl/role/roleAuth.vue"),
        meta: {
          title: "角色管理",
          hidden: true,
          activeMenu: "/acl/role/list",
        },
      },
      {
        name: "Permission",
        path: "/acl/permission/list",
        component: () => import("@/views/acl/permission/index.vue"),
        meta: {
          title: "菜单管理",
        },
      },
    ],
  },
  // 商品管理 也是一个一级路由，包含了4个二级路由
  {
    path: "/product",
    name: "Product", //这个名字代表命名路由，后期是要在权限控制当中去使用的，必须配而且名字必须固定，不能变
    component: () => import("@/layout/index.vue"),
    // redirect:'', //不需要重定向，因为它跳转不了，变为箭头，进行展开和合并二级路由菜单了

    // 如果一级路由里面有多个二级路由，那么一级路由的meta需要配置，并且要带标题和图标
    // 如果一级路由里面只有一个二级路由，那么一级路由后面就会被唯一的二级路由替代，直接
    // 让二级路由称为一级路由的菜单，带图标和标题
    meta: {
      title: "商品管理",
      icon: "ele-Goods",
    },
    children: [
      {
        path: "trademark/list",
        component: () => import("@/views/product/trademark/index.vue"),
        // 如果一级路由有菜单并且有图标和标题，那么二级路由只需要配置标题就可以了
        // 不需要配置图标
        meta: {
          title: "品牌管理",
        },
        name: "Trademark",
      },
      {
        path: "attr/list",
        component: () => import("@/views/product/attr/index.vue"),
        meta: {
          title: "平台属性管理",
        },
        name: "Attr",
      },
      {
        path: "sku/list",
        component: () => import("@/views/product/sku/index.vue"),
        meta: {
          title: "Sku管理",
        },
        name: "Sku",
      },
      {
        path: "spu/list",
        component: () => import("@/views/product/spu/index.vue"),
        meta: {
          title: "Spu管理",
        },
        name: "Spu",
      },
    ],
  },
  //后援管理
  {
    path: "/Ikun",
    name: "IkunHome",
    component: () => import("@/layout/index.vue"),
    meta: {
      title: "Ikun后援会管理",
      icon: "ele-Goods",
    },
    children: [
      {
        path: "Ikun01",
        name: "Ikun01",
        component:()=>import("@/views/IkunHome/Ikun01/index.vue"),
        meta:{title:'后援会管理1'}
      },
      {
        path: "Ikun03",
        name: "Ikun03",
        component:()=>import("@/views/IkunHome/Ikun03/index.vue"),
        meta:{title:'后援会管理3'}
      }
    ],
  },
];

export const anyRoutes: Array<RouteRecordRaw> = [
  /* 匹配任意的路由 必须最后注册 */
  {
    path: "/:pathMatch(.*)",
    name: "Any",
    redirect: "/404",
    meta: {
      hidden: true,
    },
  },
];
